<?php
/**
 * The Sidebar containing the main widget area.
 *
 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */


?>
		<aside id="sidebar">
			<?php 
				//Category
				wp_list_categories('show_count=1&title_li=<h2>' . __('Categories') . '</h2>' ); 
				//Tags
				$tags = get_tags();
				$html = '<ul class="post_tags">';
				foreach ($tags as $tag){
					$tag_link = get_tag_link($tag->term_id);
					$html .= "<li><a href='{$tag_link}' title='{$tag->name} Tag' class='{$tag->slug}'>";
					$html .= "{$tag->name}</a>({$tag->count})<li>";
				}
				$html .= '</ul>';
				echo $html;
			?>
			
			<section id="tagcloud"><h2>Tag Clouds</h2><?php wp_tag_cloud(); ?></section>
			<section id="recentpost">
				<h2>Recent Posts</h2>
				<ul>
				<?php
					$args = array( 'numberposts' => '8' );
					$recent_posts = wp_get_recent_posts( $args );
					foreach( $recent_posts as $recent ){
						echo '<li><a href="' . get_permalink($recent["ID"]) . '" title="Look '.$recent["post_title"].'" >' .   $recent["post_title"].'</a> </li> ';
					}
				?>
				</ul>
			</section>
		</aside>
